跳板机管理web端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

76 lines
1.8 KiB

8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
  1. <template>
  2. <section>
  3. <!--工具条-->
  4. <el-col :span="24" class="toolbar" style="padding-bottom: 0px;">
  5. <el-form :inline="true" :model="filters">
  6. <el-form-item>
  7. <el-input v-model="filters.name" placeholder="姓名"></el-input>
  8. </el-form-item>
  9. <el-form-item>
  10. <el-button type="primary" v-on:click="getUser">查询</el-button>
  11. </el-form-item>
  12. </el-form>
  13. </el-col>
  14. <!--列表-->
  15. <template>
  16. <el-table :data="users" highlight-current-row v-loading="loading" style="width: 100%;">
  17. <el-table-column type="index" width="60">
  18. </el-table-column>
  19. <el-table-column prop="name" label="姓名" width="120" sortable>
  20. </el-table-column>
  21. <el-table-column prop="sex" label="性别" width="100" :formatter="formatSex" sortable>
  22. </el-table-column>
  23. <el-table-column prop="age" label="年龄" width="100" sortable>
  24. </el-table-column>
  25. <el-table-column prop="birth" label="生日" width="120" sortable>
  26. </el-table-column>
  27. <el-table-column prop="addr" label="地址" min-width="180" sortable>
  28. </el-table-column>
  29. </el-table>
  30. </template>
  31. </section>
  32. </template>
  33. <script>
  34. import { getUserList } from '../../api/api';
  35. //import NProgress from 'nprogress'
  36. export default {
  37. data() {
  38. return {
  39. filters: {
  40. name: ''
  41. },
  42. loading: false,
  43. users: [
  44. ]
  45. }
  46. },
  47. methods: {
  48. //性别显示转换
  49. formatSex: function (row, column) {
  50. return row.sex == 1 ? '男' : row.sex == 0 ? '女' : '未知';
  51. },
  52. //获取用户列表
  53. getUser: function () {
  54. let para = {
  55. name: this.filters.name
  56. };
  57. this.loading = true;
  58. //NProgress.start();
  59. getUserList(para).then((res) => {
  60. this.users = res.data.users;
  61. this.loading = false;
  62. //NProgress.done();
  63. });
  64. }
  65. },
  66. mounted() {
  67. this.getUser();
  68. }
  69. };
  70. </script>
  71. <style scoped>
  72. </style>